﻿using System;
using UnityEngine;

namespace UFrame
{
    public class BoolToColorConverter
    {
        public Color min = Color.black;
        public Color max = Color.white;

        public  BoolToColorConverter(){}

        public BoolToColorConverter(Color min, Color max)
        {
            this.min = min;
            this.max = max;
        }
        
        public object Convert(object value)
        {
            bool b = System.Convert.ToBoolean(value);
            return b ? max : min;
        }

        public object ConvertBack(object value)
        {
            float b = System.Convert.ToSingle(value);
            return (Color)value == max;
        }
    }
}